package knowse.app;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class TestDataObject implements Parcelable {
	
	private String testClass;
	private String method;
	private String message;
	private String type;
	private String location;
	
	
	//parsing JSON from JSONObject .
	//Author: Xi
	
	public TestDataObject(JSONObject test) throws JSONException{
		//parsing....
		this.testClass=test.getString("class");
		this.method=test.getString("method");
		this.message=test.getString("message");
		this.type=test.getString("type");
		this.location=test.getString("location");
		
	}
	
	//print TestDataObject
	//Author: Xi
	public void PrintOutTestDataObject(){
		System.out.println("testClass: " + testClass+ "\n"+
						  "method: " +method+"\n"+
						  "message: "+message+"\n"+
						  "type: "+type+"\n"+
						  "location: "+location+"\n");
	}
	
	
	public TestDataObject(String testClass, String method, String message, String type, String location)
	{
		this.testClass = testClass;
		this.method = method;
		this.message = message;
		this.type = type;
		this.location = location;
	}
	
	public TestDataObject() {
		// TODO Auto-generated constructor stub
	}

	public String getTestClass() {
		return testClass;
	}



	public void setTestClass(String testClass) {
		this.testClass = testClass;
	}




	public String getMethod() {
		return method;
	}




	public void setMethod(String method) {
		this.method = method;
	}




	public String getMessage() {
		return message;
	}




	public void setMessage(String message) {
		this.message = message;
	}




	public String getType() {
		return type;
	}




	public void setType(String type) {
		this.type = type;
	}




	public String getLocation() {
		return location;
	}




	public void setLocation(String location) {
		this.location = location;
	}

	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void writeToParcel(Parcel parcel, int flags) {
		parcel.writeString(testClass);
		parcel.writeString(method);
		parcel.writeString(message);
		parcel.writeString(type);
		parcel.writeString(location);
		
	}
	
	public static final Parcelable.Creator<TestDataObject> CREATOR= new Creator<TestDataObject>(){

		public TestDataObject createFromParcel(Parcel source) {
			TestDataObject testDataObj= new TestDataObject();
			testDataObj.testClass=source.readString();
			testDataObj.method=source.readString();
			testDataObj.message=source.readString();
			testDataObj.type=source.readString();
			testDataObj.location=source.readString();			
			return testDataObj;
		}

		public TestDataObject[] newArray(int size) {
			// TODO Auto-generated method stub
			return new TestDataObject[size];
		}};


	
	
	
}
